#!/bin/bash

set DB_HOST=localhost
set DB_PORT=3307
set DB_NAME=hengjin
set DB_USER=root
set PASSWORD=123456
set SQL_FILES_DIR=

for sql_file in $SQL_FILES_DIR/*.sql; do
    echo "Executing: $sql_file"
    mysql -h$DB_HOST -P$DB_PORT -u$DB_USER -p$PASSWORD $DB_NAME --default-character-set=utf8< < $sql_file
    if [$? -ne 0]; then
      echo "Execution failed for: $sql_file"
    else
      echo "Exection successful for: $sql_file"
    fi
done
echo "All SQL files executed."
read -p "Press Enter to close"
